$(document).ready(function(){
	var rId=$('#rId').val();
	var pId=$('#pId').val();
	eventBind(pId,rId);
});
//事件绑定
function eventBind(pId,rId){
	$('#cancel').click(function(){
		BootstrapDialog.closeAll();
	})
	$('#save').on('click',function(){
		saveRegReson(pId,rId);
	});
}
//挂号操作
function saveRegReson(pId,rId){
	if(!$("#resonForm").validationForm()){
		return;
	}
	$.getApiClient('/register/unRegister/{pId}/{rId}').setQuery({
		pId:pId,
		rId:rId
	}).put($('#regForm').collect()).done(function(data){
		if(data.code == "0"){
			BootstrapDialog.closeAll();
			customTimeOutDialog('信息提示','取消预约成功',null,2000);
			pageQuery();
		}else{
			BootstrapDialog.closeAll();
			customAlertDialog(data.message, '错误提示', null, null);
		}
	});
}
